﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace myClient
{
    public partial class frmCommand : Form
    {
        private frmMain _mainform = null;

        public frmCommand( frmMain mainform )
        {
            InitializeComponent();
            this._mainform = mainform;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (_mainform != null && ( cbCmd.SelectedItem != null || !cbCmd.Text.Equals("")  ))
            {
                string cmd = cbCmd.Text;
                _mainform.SendText(cmd);

                if (!cbCmd.Items.Contains(cmd))
                    cbCmd.Items.Add(cmd);
            }
        }
    }
}
